Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function |saturating_add

std/ops/num::|saturating_add


Usage

|saturating_add<N>(a, b)

Generics

◻ N: SaturatingAdd

Parameters

↳ a: N
↳ b: N

Return

N


Add a and b, saturating to bounds.

This function is infaillible and saturate to the closest bound, minimal or maximal, if a + b is out of bounds for the data type.